<?php


namespace App\Transformers\System;


use App\Models\SystemGroup;
use League\Fractal\TransformerAbstract;

class SystemGroupTransformer extends TransformerAbstract
{
    public function transform(SystemGroup $data)
    {
        return [
            'id' => $data->id,
            'name' => $data->name ?? '',
            'info' => $data->info ?? '',
            'config_name' => $data->config_name ?? '',
            'fields' => $data->fields ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
